/*
 * @Description: 文件中心
 * @Author: DHL
 * @Date: 2021-12-31 14:52:24
 * @LastEditors: DHL
 * @LastEditTime: 2022-08-30 13:33:52
 */

import { RequestParams } from '/@/constant/http'
import { Result } from '/@/model/baseModel'
import { $download, $post, $get } from '/@/utils/http'

/**
 * 文件下载
 * @param params
 * @returns
 */
export const apiFileDownload = (fileId: string, fileName: string, progressCallback?: Function) =>
  $download({
    url: '/fileCenter/download',
    params: { fileId: fileId },
  }, fileName, progressCallback)

/**
 * 文件批量逻辑删除
 * @param fileIds 
 * @returns 
 */
export const apiFileBatchDelete = (fileIds: string) =>
  $post<Result<string>>({
    url: '/system/twbEnclosure/logicBatchDeleteByIds',
    params: {
      ids: fileIds
    }
  })

/**
 * 查询文件
 * @param params 
 * @returns 
 */
export const apiFileSearch = (params: RequestParams) =>
  $get<Result<Array<any>>>({
    url: '/system/twbEnclosure/serverFiles',
    params: params
  })